
package sadec;
import java.awt.*;
import javax.swing.*;

/**
 *
 * @author RULBER
 */
public class fondoJframes extends javax.swing.JPanel {

    int tipo;
    
    public fondoJframes(int x, int y, int t) {
        initComponents();
        this.setSize(x,y);
        tipo = t;
    }

    @Override
    public void paint(Graphics g)
    {
        if(tipo == 1)
        {
            Dimension tam=getSize();
            ImageIcon ImagenFondo = new ImageIcon(new ImageIcon(getClass().getResource("/imagenes/fondo.png")).getImage());
            g.drawImage(ImagenFondo.getImage(),0, 0,tam.width,tam.height,this);
            setOpaque(false);
            super.paint(g);
        }
        if(tipo == 2)
        {
            Graphics2D g2 = (Graphics2D) g.create();
            Rectangle clip = g2.getClipBounds();                        
            g2.setPaint(new GradientPaint(0.0f, 0.0f, Color.CYAN.darker(),0.0f ,getHeight(), Color.WHITE.darker()));        
            g2.fillRect(clip.x, clip.y, clip.width, clip.height);
        }
        
    }
    
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 400, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 300, Short.MAX_VALUE)
        );
    }// </editor-fold>//GEN-END:initComponents
    // Variables declaration - do not modify//GEN-BEGIN:variables
    // End of variables declaration//GEN-END:variables
}
